package cn.community.system.service.impl;

import cn.community.system.domain.Member;
import cn.community.system.mapper.MemberMapper;
import cn.community.system.mapper.MemberReportMapper;
import cn.community.system.query.MemberReportQuery;
import cn.community.system.query.QueryObject;
import cn.community.system.service.IMemberReportService;
import cn.community.system.util.UserContext;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class MemberReportServiceImpl implements IMemberReportService {

    @Autowired
    private MemberReportMapper memberReportMapper;

    @Override
    public PageInfo selectAllActivityReport(MemberReportQuery qo) {
        Member member = UserContext.getCurrentMember();
        qo.setUserId(member.getId());
        System.out.println(member.getId());
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<Map> list = memberReportMapper.selectAllActivityReport(qo);
        return new PageInfo(list);
    }

    @Override
    public List<Map> listAll(MemberReportQuery qo) {
        Member member = UserContext.getCurrentMember();
        qo.setUserId(member.getId());
        return memberReportMapper.selectAllActivityReport(qo);
    }
}
